package net.xiduth.game.player;

import java.util.TimerTask;

import net.xiduth.cores.CoresManager;

public class LoyaltyManager {

	private transient Player player;

	public LoyaltyManager(Player player) {
		this.player = player;
	}

	public void startTimer() {
		CoresManager.fastExecutor.schedule(new TimerTask() {
			int timer = 1800;

			@Override
			public void run() {
				if (timer == 1) {
					player.getBank().addItem(13727, 25, true);
					player.setLoyaltyPoints(player.getLoyaltyPoints() + 250);
					player.setSpins(player.getSpins() + 1);
					timer = 1800;
					player.getPackets()
							.sendGameMessage(
									"<col=008000>You have recieved 250 loyalty points, 25x Stardust, and a spin for playing Xiduth for 30 minutes!");
					player.getPackets().sendGameMessage(
							"<col=008000>You now have "
									+ player.getLoyaltyPoints()
									+ " Loyalty Points!");
					player.getPackets().sendGameMessage(
							"<col=008000>You now have "
									+ player.getSpins()
									+ " Spins!");
				}
				if (timer > 0) {
					timer--; // start loop
				
				}
				  if (player.yellDelay > 0) {
					     player.yellDelay--;
				  }
			}
		}, 0L, 1000L);
	}
}